<template>
  <div class="container">
    <data-view propViewKey="fsd_station" propViewForm="fsd/station/detail.vue" @extra-button-click="extraButtonClick" />
  </div>
</template>

<script>
export default {
  name: 'station',
  data() {
    return {}
  },
  components: {},
  methods: {
    async extraButtonClick({ button, data, index }) {
      let buttonKey = button.key
      if (buttonKey == 'upgrade') {
        await this.utilVue.loadShow(true)
        await this.$confirm('请确保最新的程序已经上传到服务器，并在更新后及时观察智能柜程序是否正常?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(() => {
            this.$ajax
              .post('back_front/stations/updateClientService', { stationCode: data.stationCode })
              .then((response) => {
                this.utilVue.loadHide()
                // if (response.success) {
                //   that.propParent.ocRefresh()
                // } else {
                //   that.utilMessage.error(response.msg)
                // }
              })
          })
          .catch(() => {
            this.utilVue.loadHide()
          })
      }
    },
  },
  props: ['propFlowKey'],
}
</script>

<style lang="scss" scoped>
.container {
  height: 100%;
  background-color: #fff;
}
</style>
